package feng.demo.config;

import cn.dev33.satoken.stp.StpInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
@Component
//拦截路径获取用户权限
public class SatokenStpInterface implements StpInterface {
    @Autowired
    RedisTemplate  redisTemplate;
//    添加方法用户权限
    @Override
    public List<String> getPermissionList(Object o, String s) {
        return null;
    }

//    添加角色
    @Override
    public List<String> getRoleList(Object o, String s) {
        List<String> roleList = new ArrayList<>();
        try {
            Object u = redisTemplate.opsForValue().get(""+o);
            roleList.add(""+u);
        }catch (Exception e){

        }
        return roleList;
    }
}
